#if $str($getVar('mco_auto_setup','')) == "1"
mkdir -p /etc/mcollective
cat <<EOCONF > /etc/mcollective/server.cfg
main_collective = mcollective
collectives = mcollective
libdir = /usr/libexec/mcollective
logfile = /var/log/mcollective.log
loglevel = debug
daemonize = 1
direct_addressing = 1

# Set huge value of ttl to avoid cases with unsyncronized time between nodes
# It means that ttl approximately equal to 50 days
ttl = 4294957

# Plugins
securityprovider = psk
plugin.psk = $mco_pskey

#if $str($getVar('mco_connector', 'stomp')) == "stomp"
connector = stomp
plugin.stomp.host = $mco_host
plugin.stomp.port = $mco_port
plugin.stomp.user = $mco_user
plugin.stomp.password = $mco_password
#else
connector = rabbitmq
plugin.rabbitmq.vhost = $mco_vhost
plugin.rabbitmq.pool.size = 1
plugin.rabbitmq.pool.1.host = $mco_host
plugin.rabbitmq.pool.1.port = $mco_port
plugin.rabbitmq.pool.1.user = $mco_user
plugin.rabbitmq.pool.1.password = $mco_password
plugin.rabbitmq.heartbeat_interval = 30
#end if


# Facts
factsource = yaml
plugin.yaml = /etc/mcollective/facts.yaml
EOCONF
#end if

#if $str($getVar('mco_enable', '')) == "1"
# turn on mcollective service after reboot and set priority to 81
sed -i /etc/rc.d/init.d/mcollective -e 's/\(# chkconfig:\s\+[-0-6]\+\) [0-9]\+ \([0-9]\+\)/\1 81 \2/'
/sbin/chkconfig mcollective on
#end if
